function getTopUrl() {
	const href = parent.window.location.href
	const pathname = parent.window.location.pathname
	const pathIndex = href.indexOf(pathname)
	const topUrl = href.substring(0, pathIndex)
	return topUrl
}
var controller = {
	el: '#app',
	data:{
    	  loginForm:{
    		  formName:"loginForm",
    		  data:{
    			  acc:'admin',
            	  pwd:'123456'
    		  }
    	  },
		iconUrl: top._CTX+ "/images/login.png"
    },
    mounted:function() {
		this.getIconUrl()
    },
    methods: {
        check:function() {
        	 if(!this.loginForm.data.acc){
         		  this.$message("请输入账号");
         		  return;
         	  }
         	  if(!this.loginForm.data.pwd){
         		  this.$message("请输入密码");
         		  return;
         	  }
          var _this = this;
		  loginReFogService.check({account:_this.loginForm.data.acc,pwd:_this.loginForm.data.pwd},{
    	  	success:function(ret){
    		  top.location.href=top._CTX+"/";
    	  	},
    	  	fail:function(ret){
				_this.$message(ret.msg);
    	  	}
  	      });
  		},
		getIconUrl: function () {
			const _this = this;
			_HTTP.post(top._CTX + "/api/settings/getSettings", ['logo'], {
				success(res) {
					// console.log(res)
					if (res != null && res.length > 0) {
						_this.iconUrl = top._CTX + res[0].value;
						console.log(_this.iconUrl)
					}
				},
				fail(res) {
					// console.log(res)
				}
			})
		}
    }
};

var app = new Vue(controller); 